package homework41;

public class Division extends AbstractExpression {

    private final AbstractExpression left;
    private final AbstractExpression right;

    public Division(AbstractExpression left,AbstractExpression right){
        this.left = left;
        this.right =right;
    }
    @Override
    Integer interpreter(Context contex) {
        int right = this.right.interpreter(contex);
        if(right != 0){
            return left.interpreter(contex)/right;
        }
        return -1;
    }
}
